package io;

import java.io.*;
import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/05/09 20:47
 **/
public class CopyFile {
    public static void main(String[] args) throws IOException {
        // 源文件；src.png
        // 目标文件：dest.png
        try (InputStream is = new FileInputStream("D:\\电影\\文件操作\\src.png")){
            try (OutputStream os = new FileOutputStream("D:\\电影\\文件操作\\dest.png")){
                byte[] buf = new byte[1024];
                while (true){
                    int n = is.read(buf);
                    if(n == -1){
                        break;
                    }

                    os.write(buf,0,n);
                }
                os.flush();
            }
        }
    }

}